package ru.ifmo.thesis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.ifmo.thesis.domain.Job;
import ru.ifmo.thesis.domain.Shedule;
import ru.ifmo.thesis.domain.Worker;
import ru.ifmo.thesis.solver.gp.GPSolver;
import ru.ifmo.thesis.task.Task;
import ru.ifmo.thesis.task.TaskGenerator;
import ru.ifmo.thesis.util.Loggers;

public class Main {

	private static final Logger logger = LoggerFactory.getLogger(Main.class);
	
	public static void main(String[] args) {
		Loggers.initLoggerFromConfig();

		TaskGenerator taskGenerator = new TaskGenerator();
		Task task = taskGenerator.generateTask();
		
		GPSolver solver = new GPSolver();
		printSolution(solver.solve(task));
	}

	private static void printSolution(Shedule bestAnswer) {
		for (Worker w : bestAnswer.getWorkers()) {
			System.out.println("Worker: " + w);
			for (Job t : bestAnswer.getPersonalShedule(w)) {
				System.out.println("\t" + t);
			}
		}
	}
	
}
